<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<style>
    #hw01,#hw02 {
        width: 120px;
        height: 50px;
    }
    #outside{
        padding: 0;
        margin: 0;
        width: 100%;
        height: 100%;
        position: absolute;
    }
    #inside {
        margin: 0 auto;
    }
    body {
        text-align: center;
    }
</style>
<body>
    <div id="outside">
        <div id="inside">
            <a href="01 register.html"><button id="hw01"><b>点我查看作业1</b></button></a>
            <a href="dangdangframe.html"><button id="hw02"><b>点我查看作业2</b></button></a>
        </div>
    </div>
    <script>
    var colors = ["red","orange","pink","green","purple"];
    var i = 0;
    function bian() {
        var j = Math.floor(Math.random()*colors.length);
        document.getElementById("hw01").style.color = colors[j];
        document.getElementById("hw02").style.color = colors[j];
        document.getElementById("outside").style.background = colors[i];
        i++;
        if(i == colors.length) {
            i = 0;
        }
    }
    setInterval(bian,1000);
    </script>
</body>
</html>